import axios from 'axios';
// 创建实例对象
const axiosInstance = axios.create({
    // baseURL:'http://localhost:3000'
    baseURL:'/admin'
});

axiosInstance.interceptors.request.use((request) => {
    const { token } = JSON.parse(localStorage.getItem('adminLoginInfo') || '{}');
    if (!token) {
        request.headers.Authorization = token;
    }
    return request;
});

axiosInstance.interceptors.response.use((response) => {
    return response.data;
});

export default axiosInstance;